package com.oocl.ha.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;

@Entity
@Table(name = "tdish")
public class Dish implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE)
	@Column(name = "did")
	private Integer did;

	@Column(name = "dname")
	private String dname;

	@Column(name = "price")
	private Double price;

	@Column(name = "dicon")
	private String dicon;

	@Column(name = "recommend")
	private Integer recommend;
	
	@JsonManagedReference
	@ManyToOne(targetEntity = Merchant.class)
	@JoinColumn(name = "mid", referencedColumnName = "mid")
	private Merchant merchant;

	public Dish() {
		super();
	}

	public Dish(String dname, Double price, String dicon, Integer recommend, Merchant merchant) {
		super();
		this.dname = dname;
		this.price = price;
		this.dicon = dicon;
		this.recommend = recommend;
		this.merchant = merchant;
	}

	public Dish(Integer did, String dname, Double price, String dicon, Integer recommend, Merchant merchant) {
		super();
		this.did = did;
		this.dname = dname;
		this.price = price;
		this.dicon = dicon;
		this.recommend = recommend;
		this.merchant = merchant;
	}

	public Integer getDid() {
		return did;
	}

	public void setDid(Integer did) {
		this.did = did;
	}

	public String getDname() {
		return dname;
	}

	public void setDname(String dname) {
		this.dname = dname;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public String getDicon() {
		return dicon;
	}

	public void setDicon(String dicon) {
		this.dicon = dicon;
	}

	public Integer getRecommend() {
		return recommend;
	}

	public void setRecommend(Integer recommend) {
		this.recommend = recommend;
	}

	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}

}
